home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Tele / S / SmartClone.3.cpt / SmartClone 0.3.rsrc / STR#_1001.txt < prev    next >
Encoding:
Text File  |  1988-08-22  |  4.5 KB  |  267 lines

  1. SERVICE:     COMMAND KEY: D
  2.  
  3. HOLD ON
  4.  
  5. CURSOR WATCH
  6.  
  7. TIMER RESET
  8.  
  9. IF (@modemFile = "") OR (NOT Exists%(ServiceFPath & @modemFile)) THEN ‚àÇ
  10.  
  11.     GOSUB getModemFile
  12.  
  13. IF @MiniTermPhoneNumber = "" THEN GOSUB getMTNumber
  14.  
  15. dialIt:
  16.  
  17.     Message = @MiniTermPhoneNumber
  18.  
  19.     HOLD OFF
  20.  
  21.     DO FILE @modemFile "Dial"
  22.  
  23.     IF ResultCode% <> 0 THEN ‚àÇ
  24.  
  25.         badFile = @modemFile: ‚àÇ
  26.  
  27.         badLabel = "Dial": ‚àÇ
  28.  
  29.         GOSUB doFileError: ‚àÇ
  30.  
  31.         END
  32.  
  33.     IF Message <> "" THEN ‚àÇ
  34.  
  35.         IF @Redial% THEN GOTO dialIt ‚àÇ
  36.  
  37.         ELSE DISPLAY "Unable to connect:  " & Message
  38.  
  39.     CURSOR RESET
  40.  
  41.     END
  42.  
  43.  
  44.  
  45. getMTNumber:
  46.  
  47.     MiniTermPhoneNumber = @MiniTermPhoneNumber
  48.  
  49.     HOLD OFF
  50.  
  51.     CURSOR RESET
  52.  
  53.     SET DBOX 403
  54.  
  55.     CheckBox%(1) = @Redial%
  56.  
  57.     DBoxResp = MiniTermPhoneNumber
  58.  
  59.     DBOX 403
  60.  
  61. dialLoop:
  62.  
  63.     dbr% = DBoxResult%
  64.  
  65.     IF dbr% = -2 THEN ‚àÇ
  66.  
  67.         GOTO dialLoop
  68.  
  69.     HOLD ON
  70.  
  71.     CURSOR WATCH
  72.  
  73.     MiniTermPhoneNumber = DBoxResp(1)
  74.  
  75.     IF (dbr% <> OK%) OR (MiniTermPhoneNumber = "") THEN ‚àÇ
  76.  
  77.         END
  78.  
  79.     @Redial% = CheckBox%(1)
  80.  
  81.     CLEAR DBOX 403
  82.  
  83.     @MiniTermPhoneNumber = MiniTermPhoneNumber
  84.  
  85.     RETURN
  86.  
  87.  
  88.  
  89.  
  90.  
  91. getModemFile: 'gets name of modem file and stores it in variable @modemFile
  92.  
  93.     HOLD ON
  94.  
  95.     Message = ""
  96.  
  97.     prompt1 = "Please select the modem file:"
  98.  
  99.     fileType1 = "SERV"
  100.  
  101.     HOLD OFF
  102.  
  103.     modemFile = GetFile(prompt1,fileType1,ServiceFPath)
  104.  
  105.     IF (ResultCode% = 100) OR (DBoxResult% = CANCEL%) THEN END
  106.  
  107.     HOLD ON
  108.  
  109.     CURSOR WATCH
  110.  
  111.  
  112.  
  113.     'parse the path from string returned by GetFile
  114.  
  115.     myPath = modemFile
  116.  
  117.     lastColon% = 0
  118.  
  119. getLastColon:
  120.  
  121.     IF InStr%(lastColon%+1, myPath, ":") <> 0 THEN ‚àÇ
  122.  
  123.         lastColon% = lastColon%+1: GOTO getLastColon
  124.  
  125.  
  126.  
  127.     myPath = Left(myPath,lastColon%)
  128.  
  129.     modemFile = Mid(modemFile, lastColon%+1)
  130.  
  131.  
  132.  
  133.     ServiceFPath = myPath   ' set ServiceFPath to path returned by GetFile
  134.  
  135.     Message = ""
  136.  
  137.     HOLD OFF
  138.  
  139.     DO FILE modemFile "Identify"
  140.  
  141.     IF (ResultCode% <> 0) THEN ‚àÇ
  142.  
  143.         IF (ResultCode% <> 106) THEN ‚àÇ          ' bad label error
  144.  
  145.             badFile = modemFile: ‚àÇ              ' 106 is "label not found" error
  146.  
  147.             badLabel = "Identify": ‚àÇ
  148.  
  149.             GOSUB doFileError: ‚àÇ
  150.  
  151.             CURSOR RESET: ‚àÇ
  152.  
  153.             END ‚àÇ
  154.  
  155.         ELSE Message = "NotModem"               ' coerce dbox for error #106
  156.  
  157.  
  158.  
  159.     ' check for if modemFile is really a modem file
  160.  
  161.     IF UpCase(Message) <> "MODEM" THEN ‚àÇ
  162.  
  163.         DBoxSay = modemFile & " does not appear to be a modem file.  " & ‚àÇ
  164.  
  165.             "An example of a modem file for Apple and " & ‚àÇ
  166.  
  167.             "Hayes-compatible modems is ""Hayes Modem.""  Try again?": ‚àÇ
  168.  
  169.         DBOX 2: ‚àÇ
  170.  
  171.         IF DBoxResult% = OK% THEN GOTO getModemFile ‚àÇ
  172.  
  173.         ELSE CURSOR RESET: END
  174.  
  175.     HOLD ON
  176.  
  177.  
  178.  
  179.     ' check to see if modem file in Lookup Table is still there
  180.  
  181.     IF @ModemFile <> "" THEN ‚àÇ
  182.  
  183.         IF NOT Exists%(ServiceFPath & @modemFile) THEN CLEAR @modemFile ‚àÇ
  184.  
  185.         ELSE DO FILE @modemFile "ClearTable": ‚àÇ
  186.  
  187.             IF ResultCode% <> 0 THEN ‚àÇ  ' check for errors executing "DO FILE"
  188.  
  189.                 badFile = @modemFile: ‚àÇ
  190.  
  191.                 badLabel =  "ClearTable": ‚àÇ
  192.  
  193.                 GOSUB doFileError: ‚àÇ
  194.  
  195.                 END
  196.  
  197.  
  198.  
  199.     @modemFile = modemFile  ' put new modem file in lookup table
  200.  
  201.     HOLD OFF
  202.  
  203.     CURSOR RESET
  204.  
  205.     Message = ""            ' routine was successful
  206.  
  207.     RETURN
  208.  
  209.  
  210.  
  211. doFIleError:    ' puts up error dialog and aborts
  212.  
  213.  
  214.  
  215.     HOLD OFF
  216.  
  217.     BELL:BELL   ' alert user
  218.  
  219.     ' Give user a description of error
  220.  
  221.     IF ResultCode% = 106 THEN DBoxSay = "Cannot find the label """ & badLabel & ‚àÇ
  222.  
  223.         """ in the file """ & badFile & """.  Program aborted." ‚àÇ
  224.  
  225.     ELSE IF ResultCode% = -108 THEN ‚àÇ
  226.  
  227.         DBoxSay = "Not enough memory to open the file """ & ‚àÇ
  228.  
  229.         badFile & """.  Program aborted." ‚àÇ
  230.  
  231.     ELSE IF ResultCode% = -35 THEN ‚àÇ
  232.  
  233.         DBoxSay = "Cannot open the file """ & badFile & ‚àÇ
  234.  
  235.         """ because volume specified doesn't exist.  Program aborted." ‚àÇ
  236.  
  237.     ELSE IF ResultCode% = -49 THEN ‚àÇ
  238.  
  239.         DBoxSay = "Cannot open the file """ & badFile & ‚àÇ
  240.  
  241.         """ because it is already open for writing.  Program aborted." ‚àÇ
  242.  
  243.     ELSE IF ResultCode% = -47 THEN ‚àÇ
  244.  
  245.         DBoxSay = "Cannot open the file """ & badFile & ‚àÇ
  246.  
  247.         """ because it is busy.  Program aborted." ‚àÇ
  248.  
  249.     ELSE DBoxSay = "The following error occurred during a call to """ & badLabel & ‚àÇ
  250.  
  251.         """ in the file """ & badFile & """:  Macintosh error result code = " & ‚àÇ
  252.  
  253.         ResultCode% & ".  Program aborted."
  254.  
  255.     DBOX 1
  256.  
  257.     RETURN
  258.  
  259.  
  260.  
  261. Interrupt:
  262.  
  263.     DBOX 0
  264.  
  265.     LEAVE
  266.  
  267.